<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLogsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('group_id')->index()->comment('组ID');
            $table->string('group_name', 100)->nullable()->index()->comment('组名称');
            $table->string('affairtypeid', 6)->comment('事物编号');
            $table->string('affairtypename', 60)->comment('事物名称');
            $table->string('eventtypeid', 6)->comment('事件编号');
            $table->string('eventtypename', 60)->comment('事件名称');
            $table->string('actionid', 6)->comment('动作编号');
            $table->string('actionname', 60)->comment('动作名称');
            $table->string('logtitle', 100)->comment('日志标题');
            $table->string('logcontent', 1000)->comment('日志内容');
            $table->string('ip', 20)->default('')->comment('ip');
            $table->bigInteger('opuserid')->index()->comment('操作用户ID');
            $table->string('opusertitle', 20)->index()->comment('操作用户账号');
            $table->string('opusername', 100)->index()->comment('操作用户姓名');
            $table->dateTime('optime')->index()->comment('操作时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('logs');
    }
};
